package com.cjm.one.webmanager.service.goods.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.goods.client.GoodsInfoClient;
import com.cjm.one.model.goods.dto.GoodsInfoDto;
import com.cjm.one.model.goods.entity.GoodsInfo;
import com.cjm.one.model.goods.vo.GoodsInfoVo;
import com.cjm.one.webmanager.service.goods.GoodsInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsInfoServiceImpl implements GoodsInfoService {
    @Resource
    private GoodsInfoClient goodsInfoClient;
    @Override
    public Page<GoodsInfo> pageList(Long current, Long size, String name, Long categoryId) {
        return goodsInfoClient.pageList(current, size, name, categoryId).getData();

    }
    //新增商品
    @Override
    public Boolean saveGoodsInfo(GoodsInfoDto goodsInfoDto) {
        return goodsInfoClient.save(goodsInfoDto).getData();
    }

    @Override
    public Boolean removeById(Long id) {
        return goodsInfoClient.remove(id).getData();
    }

    @Override
    public Boolean updateGoodsInfo(GoodsInfoDto goodsInfoDto) {
        return goodsInfoClient.update(goodsInfoDto).getData();
    }

    @Override
    public GoodsInfoVo getGoodsInfoVoById(Long id) {
        return goodsInfoClient.getById(id).getData();
    }

    @Override
    public List<GoodsInfo> listBatchByIds(Long[] ids) {
        return  goodsInfoClient.listBatch(ids).getData();
    }
}
